package com.atguigu.gulimall.seckill.config;

import com.atguigu.gulimall.seckill.interceptor.LoginUserInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author 小坏
 * @Date 2021/3/3 1:22
 * @Version 1.0
 * @program: 父工程 gulimall 万物起源之地
 *
 * 拦截器不生效、需要配置web这个
 * 拦截器想生效必须配到web中
 */

@Configuration
public class SeckillWebConfig implements WebMvcConfigurer {
    @Autowired
    LoginUserInterceptor loginUserInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor (loginUserInterceptor).addPathPatterns ("/**");
    }
}
